import { tuiCategory, tuiObject, wenObject } from "@/types";
import { useEffect } from "react";
import { knowledgeModelState, useDispatch, useSelector } from "umi";
import style from "./style.less"
export default function ArticleStructure() {
    const Dispatch = useDispatch();
    useEffect(() => {
        // Dispatch({
        //     type: "knowledge/articlelist",
        // })
        Dispatch({
            type: "knowledge/categorylist",
        })
    }, [])
    const { categorylist } = useSelector((state: { knowledge: knowledgeModelState }) => {
        return state.knowledge
    });
    return (
        <div>
            <div className={style.wen}>
                <h2>文章分类</h2>
                <ul>
                    {categorylist.map((item: wenObject) => {
                        return <li key={item.id}>{item.label} <span>共计{item.articleCount}篇文章</span></li>
                    })}
                </ul>
            </div>
        </div>
    );
}

